/*
 * @Description: 原型模式
 * @Author: rendc
 * @Date: 2022-10-10 11:38:16
 * @LastEditors: rendc
 * @LastEditTime: 2022-10-10 11:43:18
 */
function Person () {
  Person.prototype.name = "tom";
  Person.prototype.age = 12;
  Person.prototype.gender = 1;
  Person.prototype.sayName = function () {
    console.log(this.name);
  };
}
var p1 = new Person();
p1.sayName();
var p2 = new Person();
p2.sayName();
console.log(p1.sayName == p2.sayName); // true